﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;


namespace Manager_System
{
    class DBhelp
    {

        #region 数据库连接参数
        public static string connString = "Data Source=SONY-PC\\SQLEXPRESS;Initial Catalog=Manager_System;Persist Security Info=True;User ID=sa;Password=111111";
        public static SqlConnection connection = new SqlConnection(connString);
        #endregion

        #region 查询代码
        public  SqlDataReader query(string sql)
        {
            SqlCommand ocom = new SqlCommand(sql, DBhelp.connection);
            DBhelp.connection.Open();
            SqlDataReader reader = ocom.ExecuteReader();
            return reader;
        }
        public int update(string sql)
        {
            DBhelp.connection.Open();
            int rs = 0;
            SqlCommand ocom = new SqlCommand(sql, DBhelp.connection);
            rs = ocom.ExecuteNonQuery();
            return rs;
        }
        public void close()
        {
            connection.Close();
        }

        #endregion


    }

  

}



